package com.chance.cc.crawler.development.bootstrap.ifeng.car;

import com.chance.cc.crawler.core.CrawlerEnum;
import com.chance.cc.crawler.core.filter.FilterUtils;
import com.chance.cc.crawler.core.record.CrawlerRequestRecord;
import com.chance.cc.crawler.development.controller.DevCrawlerController;

public class IFengStart {
    public static final String domain = "ifeng";

    public static final String site = "car";

    public static void main(String[] args) {


        CrawlerRequestRecord requestRecord = CrawlerRequestRecord.builder()
                .startPageRequest(domain, CrawlerEnum.CrawlerRequestType.turnPage) //turnpage 翻页
                .domain(domain)
                .httpUrl("https://ncar.auto.ifeng.com/model/home")
                .recordKey("https://ncar.auto.ifeng.com/model/home")
                .releaseTime(System.currentTimeMillis())
                .filter(CrawlerEnum.CrawlerRecordFilter.key)
                .addFilterInfo(FilterUtils.memoryFilterKeyInfo(domain))
                .build();

        requestRecord.tagsCreator().bizTags().addDomain(domain);
        requestRecord.tagsCreator().bizTags().addSite(site);


        DevCrawlerController.builder()
                .triggerInfo(domain, domain, System.currentTimeMillis(), domain)
                .crawlerRequestQueue(DevCrawlerController.devRequestQueue(domain))  //管道
                .consoleResultPipeline() //控制台输出
                .fileResultPipeline("D:\\chance\\log\\ifeng.log", false) //文件输出
                .requestRecord(requestRecord)
                .build("com.chance.cc.crawler.development.scripts.ifeng.car")
                .start();
    }

}
